import asyncio
from .mcp_client import MCPClient


async def main():
    async with MCPClient() as client:
        # 列出所有可用工具
        tools = await client.list_tools()
        print("Available tools:", tools)

        # 调用工具示例
        try:
            weather = await client.invoke_tool("get_weather", {"city": "Beijing"})
            print("Weather result:", weather)
        except Exception as e:
            print("Tool invocation failed:", e)


if __name__ == "__main__":
    asyncio.run(main())